package com.sandman.article.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @author 范珈诚
 * time 9:52 PM 9/26/22
 * notes
 */
@Component
public class MpMetaObjectHandler implements MetaObjectHandler {

    Logger logger = LoggerFactory.getLogger(MpMetaObjectHandler.class);

    @Override
    public void insertFill(MetaObject metaObject) {
        logger.info("自动插入时间");
        this.setFieldValByName("insertTime", LocalDateTime.now(), metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        //空
    }
}
